package com.weijin.bookborrowmanagesystem.factory;

import org.springframework.stereotype.Component;

/**
 * @Author WeiJin
 * @Version 1.0
 * @Date 2025/3/13 11:01
 */
@Component
public class BorrowFactory {
    /**
     * 工厂模式 ：根据角色创建不同的借阅对象
      * @param role 角色
     * @return 借阅对象
     */
    public BorrowUtil getBorrow(Integer role){
        if (null == role){
            return null;
        }
        if (role == 0){
            return new StudentBorrowUtil();
        }else if (role == 1){
            return new TeacherBorrowUtil();
        }
        return null;
    }
}
